﻿using System;
using System.IO;

namespace Sasa.QualityTools.CodeAnalysis.Core.Models
{
    public class FxCopReportValueCoordinator : IFxCopReportValueCoordinator
    {
        public string FxCopProjectPath { get; set; }


        public void Coordinate(Problem problem)
        {
            if (problem == null)
            {
                throw new ArgumentNullException("problem");
            }

            if (problem.AssemblyPath == null)
            {
                return;
            }
            else if (problem.AssemblyPath.Contains("$(ProjectDir)"))
            {
                var path = problem.AssemblyPath.Replace("$(ProjectDir)", Path.GetDirectoryName(FxCopProjectPath));
                problem.AssemblyPath = Path.GetFullPath(path);
            }
        }
    }
}
